[Cakephp] How to use Read()

Posted by kwokwai on Stack Overflow See other posts from Stack Overflow or by kwokwai
Published on 2010-05-12T18:46:34Z Indexed on 2010/05/12 19:24 UTC
Read the original article Hit count: 99

Filed under:

Hi all,

In a Controller, I got this:

 $this->Site1->post_id=$id;
 $this->set('posts', $this->Site1->read()); 

And when I replaced it by this line of code: $this->set('posts', $this->Site1->read('post_id', $id));

But the returned result is totally different.

Is there any difference between them?

Is it possible to make this two lines of code neat by re-writing it into one line of code?

 $this->Site1->post_id=$id;
 $this->set('posts', $this->Site1->read()); 

© Stack Overflow or respective owner

Related posts about cakephp